package top.dark.design.patterns.singleton;

/**
 * Author: Darkn
 * description: 懒汉式，同步方法，能保证实例唯一，懒加载，but使用的同步方法每次线程进来都需要获取锁，效率低
 * Create Time: 2021/4/25 16:26
 */
public class Singleton04 {
    private static Singleton04 singleton = null;
    public static  synchronized Singleton04 getInstance(){
        if (singleton == null) {
            singleton = new Singleton04();
        }
        return singleton;
    }
}
